package test1230am;

public class Test21 {
    public static void main(String[] args) {
        // (22)打印两个数组的交集
        int[] arr = {1,2,3,4,5};
        int[] brr = {3,4,5,6,7};
        for (int a:arr) {
            // 思路：如果brr中也有a、打印a：测试驱动开发的思想
            boolean x = m(brr, a);
            if (x) {
                System.out.println(a);
            }
        }
    }

    // 注意力：思路：brr是否存在元素a
    public static boolean m(int[] brr, int a) {
        for (int b:brr) {
            if (b == a) {
                return true;
            }
        }
        return false;
    }

}
